use crate::db::db_init::db_init;
use anyhow::Result;

pub async fn db_delete(key: &str) -> Result<()> {

    let db_pool = db_init().await;
    let mut tx = db_pool.begin().await?;

    sqlx::query("delete from config where key = ?")
        .bind(key)
        .execute(&mut *tx)
        .await?;
    return Ok(());
}
pub async fn db_delete_all() -> Result<()>{
    let db_pool = db_init().await;
    sqlx::query("DELETE FROM config")
        .execute(&*db_pool)
        .await?;
    return Ok(());
}